<div class="briefMenu modal-header border-bottom clearfix">
    <div class="modal-title text-truncate fs-6">
        <button type="button" class="mdi mdi-chevron-left mdi-right-backing dcolor" data-rid="$rid" onclick="reback_last(this)"></button>
        <span class="right-imgname text-truncate">{lang history_revision}<span class="text-muted">（{$total}条记录）</span></span>
    </div>
    <button type="button" class="toggRight btn-close"></button>
</div>
<div class="historyMenu versionmenulist scroll-y">
    <ul class="list-group list-group-flush">
        <!--{loop $versions $v}-->
        <li class="list-group-item d-flex justify-content-between align-items-start version_menu" id="version_{$v[vid]}">
            <div class="unameMenu-upload">
              <div class="fw-bold text-truncate"><!--{if !$v['vname']}-->$v['username']<!--{else}-->$v[vname]<!--{/if}--></div>
              <!--{if $v['vdesc']}--><span class="form-text text-truncate">$v['vdesc']</span><!--{/if}-->
              <div class="versioninfos">
                  {eval echo dgmdate($v['dateline'],'Y-m-d H:i:s');}
                  <!--{if $fileinfo['vid'] == $v['vid']}--><span class="badge badge-outline-primary">{lang principal_edition}</span><!--{/if}-->
              </div>
            </div>
            <span class="editMenu">{eval echo formatsize($v['size']);}</span>
            <a href="javascript:;" class="group-editMenu dropdown-toggle fs-5" data-toggle="dropdown"></a>
            <ul class="dropdown-menu dropdown-menu-version">
                <li><a class="dropdown-item" href="javascript:;" data-rid="$v[rid]" data-vid="$v[vid]" onclick="infoversion(this)"><i class="mdi mdi-information-variant"></i><span class="file-text">{lang version_information}</span></a></li>
                <li>
                    <a href="javascript:;" class="view_versions dropdown-item" data-dpath="$fileinfo[dpath]" data-vid="$v[vid]" onclick="viewversion(this)">
                        <i class="mdi mdi-eye"></i><span class="file-text">{lang view_version}</span>
                    </a>
                </li>
                <!--{if $fileinfo['editperm']}-->
                <!--{if $v[vid]}-->
                <li>
                    <a href="javascript:;" class="primary_versions dropdown-item" data-vid="$v[vid]" <!--{if $fileinfo['vid'] == $v['vid']}-->data-primary="yes"<!--{else}--> data-primary="no"<!--{/if}--> onclick="primaryVersion(this)"><i class="mdi mdi-flare"></i><span class="file-text">{lang sign_principal_edition}</span></a>
                </li>
                <!--{/if}-->
                <li>
                    <a href="javascript:;" class="edit_versions dropdown-item" data-rid="$fileinfo[rid]" data-vid="$v[vid]" onclick="editVersionName(this)">
                        <i class="mdi mdi-pencil"></i><span class="file-text">{lang edit_version_information}</span>
                    </a>
                </li>
                <!--{if $v[vid]}-->
                <li>
                    <a href="javascript:;" class="delete_versions dropdown-item" data-rid="$fileinfo[rid]" data-vid="$v[vid]" onclick="deletethisversion(this)">
                        <i class="mdi mdi-delete"></i><span class="file-text">{lang delete_this_version}</span>
                    </a>
                </li>
                <!--{/if}-->
                <!--{/if}-->
            </ul>
        </li>
        <!--{/loop}-->
        <!--{if $vnext}-->
        <li class="mb-1 d-grid btn_button_more">
            <a href="javascript:;" class="btn btn-link btn-sm text-end" onclick="loadMoreVersion(this,'{$vnext}');" data-rid="{$rid}">{lang upload_more}</a>
        </li>
        <!--{/if}-->
    </ul>
</div>

<script type="text/javascript">
    function reback_last(obj) {
        var rid = [$(obj).data('rid')];
        $.post(MOD_URL + '&op=dynamic&do=getfiledynamic', {'rid': rid}, function (data) {
            $('#rightMenu').html(data);
        });
        _filemanage.infoPanelUrl = rid;
        return false;
    }
    jQuery('.versionmenulist.scroll-y').scroll(function(e) {
        var clientHeight = jQuery('.versionmenulist.scroll-y').height();
        var scrollHeight =jQuery('.versionmenulist.scroll-y').get(0).scrollHeight;
        if(jQuery('.versionmenulist.scroll-y').scrollTop()+clientHeight>scrollHeight-20) jQuery('.btn_button_more a').trigger('click');
        if($(this).scrollTop()>0){
            $('.briefMenu').css({'box-shadow':'0px 0px 10px 0px rgba(0,0,0,0.15)'});
        }else{
            $('.briefMenu').css({'box-shadow':'none'});
        }
    })
    function loadMoreVersion(obj,next){
        var rid = $(obj).data('rid');
        $.post(MOD_URL + '&op=dynamic&do=loadmoreversion',{'rid':rid,'next':next}, function (html) {
            jQuery('.versionmenulist .btn_button_more').replaceWith(html);
            _explorer.Scroll();
        })
    }
</script>